﻿<UserControl x:Class="ChessPlatform.UI.Desktop.Controls.PlayerChoiceControl"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
        xmlns:viewModels="clr-namespace:ChessPlatform.UI.Desktop.ViewModels"
        xmlns:converters="clr-namespace:ChessPlatform.UI.Desktop.Converters"
        mc:Ignorable="d"
        d:DesignHeight="300" d:DesignWidth="300"
        d:DataContext="{d:DesignInstance Type=viewModels:PlayerChoiceControlViewModel,IsDesignTimeCreatable=False}">

    <UserControl.Resources>
        <converters:PlayerDataPropertyGridVisibilityConverter x:Key="PlayerDataPropertyGridVisibilityConverter" />
    </UserControl.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <ComboBox Grid.Row="0" Margin="0,0,0,5" Name="PlayerTypeComboBox" HorizontalAlignment="Stretch"
                ItemsSource="{Binding PlayerControlItems}" IsSynchronizedWithCurrentItem="True" />

        <xctk:PropertyGrid Grid.Row="1" Name="PlayerDataPropertyGrid"
                SelectedObject="{Binding SelectedPlayerControlItem.Value.CreationData,UpdateSourceTrigger=PropertyChanged}"
                AutoGenerateProperties="True"
                UpdateTextBoxSourceOnEnterKey="True"
                MinHeight="140"
                ShowSearchBox="False"
                ShowSortOptions="False" ShowSummary="False" ShowTitle="False" IsCategorized="False"
                Visibility="{Binding Path=SelectedPlayerControlItem.Value.CreationData,Converter={StaticResource PlayerDataPropertyGridVisibilityConverter}}"
                NameColumnWidth="200" />
    </Grid>
</UserControl>